# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class KuaishouItem(scrapy.Item):
    # define the fields for your item here like:
    user_id = scrapy.Field()
    user_name = scrapy.Field()
    mv_url = scrapy.Field()
    caption = scrapy.Field()
    music_name = scrapy.Field()
    comment_count = scrapy.Field()
    like_count = scrapy.Field()
    view_count = scrapy.Field()
    referer = scrapy.Field()

    def get_sql(self):
        sql = 'insert into kuaishou values(Null,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = [self["user_id"],self["user_name"],self["mv_url"],self["caption"],self["music_name"],self["comment_count"],self["like_count"],self["view_count"],self["referer"]]
        return sql, data




